From 66939bab93cdcb9b7732c45d7bc3b99b6951fe15 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Wed, 7 Oct 2026 19:17:14 +0200 Subject: feat: promote a reference as the primary shown in lists Add an is_primary flag to references; the promoted ref sorts first on the item page and is the one shown under the item in the list and catalog. Item page gets a star toggle per reference. --- src/routes/grocery/[id]/+page.server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/routes/grocery/[id]/+page.server.ts') diff --git a/src/routes/grocery/[id]/+page.server.ts b/src/routes/grocery/[id]/+page.server.ts index 656e19c..a4ad377 100644 --- a/src/routes/grocery/[id]/+page.server.ts +++ b/src/routes/grocery/[id]/+page.server.ts @@ -6,10 +6,11 @@ import { loadAll as loadCategories } from '$lib/server/services/categories'; import { loadForGrocery, add as addRef, + promote, deleteReference, } from '$lib/server/services/references'; import { updateGrocery, deleteGrocery } from '$lib/server/services/groceries'; -import { deleteByIdAction } from '$lib/server/services/grocery-actions'; +import { idAction } from '$lib/server/services/grocery-actions'; import { numericId, parseFormString, @@ -70,7 +71,9 @@ export const actions: Actions = { }, delete: ({ request }) => - deleteByIdAction(request, deleteReference, { type: 'delete' }), + idAction(request, deleteReference, { type: 'delete' }), + + promote: ({ request }) => idAction(request, promote, { type: 'promote' }), update: async ({ request, params }) => { const data = await request.formData(); -- cgit v1.3